home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5451 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: news.uh.edu!usenet
  2. From: Sensarn <txs53132@bayou.uh.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Any responsible people here ?-) Help w/EGA/VGA
  5. Date: 4 Feb 1996 23:28:25 GMT
  6. Organization: AEtna Insurance Agency
  7. Message-ID: <4f3fep$snd@masala.cc.uh.edu>
  8. References: <4f0a32$dce@news1.usa.pipeline.com>
  9. NNTP-Posting-Host: sip-14286.public-dialups.uh.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1 (Windows; U; 16bit)
  14.  
  15.     The video buffer is located at A000:0000.  Set up a pointer to access 
  16. it easily:
  17.  
  18. unsigned char far *video_buffer=(unsigned char far *)0xA0000000;
  19.  
  20. Plane switching is done through I/O port 3C4h (takes words).  A linear 
  21. mode, such as mode 13h, doesn't use planes (all planes are chained 
  22. together creating a byte-per-pixel system).  Mode x plane switching works 
  23. like the following:
  24.  
  25. outp(0x3C4,2); //Function 2 -- Change Plane
  26. outp(0x3C5,plane); //Send plane value
  27.  
  28. The 'plane' variable holds a nibble containing the plane data:
  29.  
  30. 0000 = 0 = NO PLANES
  31. 0001 = 1 = PLANE 1
  32. 0010 = 2 = PLANE 2
  33. 0100 = 4 = PLANE 3
  34. 1000 = 8 = PLANE 4
  35. 0011 = 3 = PLANES 1 AND 2
  36. 0101 = 5 = PLANES 1 AND 3
  37. 1001 = 9 = PLANES 1 AND 4
  38. 0110 = 6 = PLANES 2 AND 3
  39. 1010 = 10 = PLANES 2 AND 4
  40. 1100 = 12 = PLANES 3 AND 4
  41. 0111 = 7 = PLANES 1, 2 AND 3
  42. 1011 = 11 = PLANES 1, 2, AND 4
  43. 1101 = 13 = PLANES 1, 3 AND 4
  44. 1110 = 14 = PLANES 2, 3, AND 4
  45. 1111 = 15 = PLANES 1, 2, 3, AND 4
  46.  
  47. As you can see, the port gives the programmer the ability to select a 
  48. single plane or any combinations of the four.
  49.  
  50. Screen modes such as 12h use color planes:
  51.  
  52. outp(0x3C4,2); //Function 2 -- Change Plane
  53. outp(0x3C5,color); //Change color
  54.  
  55. The 'color' variable holds the color plane value (0-15).  In this mode 
  56. (640x480x16), pixels are drawn up to eight at a time.  For example, if 
  57. you wan't to light up the first eight pixels (0,0-7,0) with yellow (color 
  58. index 14), you would write a 255 to the video buffer address 0 and send 
  59. the value '14' to the I/O port.
  60.  
  61. Steven Sensarn - txs53132@bayou.uh.edu
  62.  
  63.